﻿using System.Collections.Generic;
using System.Linq;

namespace Sidvall.Data
{
    public class NameCollection : System.Collections.ObjectModel.Collection<string>
    {
        #region Public Members

        #region AddRange

        public void AddRange(params string[] items)
        {
            AddRange(items.AsEnumerable(), false);
        }
        public void AddRange(IEnumerable<string> items)
        {
            AddRange(items, false);
        }
        public void AddRange(IEnumerable<string> items, bool removeDuplicates)
        {
            if (items == null)
                return;
            foreach (var item in items)
            {
                if (removeDuplicates)
                {
                    if (!Contains(item))
                        Add(item);
                }
                else
                {
                    Add(item);
                }
            }
        }

        #endregion
        #region Copy

        public NameCollection Copy()
        {
            var items = new NameCollection();
            foreach (var item in this)
                items.Add(item);
            return items;
        }

        #endregion

        #endregion
    }
}
